package ve.gob.cne.servicios;

import java.util.List;

import org.apache.log4j.Logger;

import ve.gob.cne.dao.Dao;
import ve.gob.cne.interfaces.IServicioHistorico;
import ve.gob.cne.to.HistoricoTo;

public class ServicioHistorico implements IServicioHistorico{
	
	private Dao dao;
	private final static Logger logger = Logger
			.getLogger(ServicioHistorico.class);

	@Override
	public void saveHistory(HistoricoTo historico) {
		dao.persist(historico);
		
	}
	
	@SuppressWarnings("unchecked")
	@Override
	public List<HistoricoTo> getHistorico(long id) {
		return (List<HistoricoTo>)dao.getObjectSession().createQuery("from HistoricoTo h where h.extintor.id=?").setParameter(0, id).list();
	}

	public Dao getDao() {
		return dao;
	}

	public void setDao(Dao dao) {
		this.dao = dao;
	}

}
